package day08;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo08 {

	public static void main(String[] args) {
		SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
		Date date;
		int age = 0;

		String str = null;
		String s1 = "33";
		try {
			date = fmt.parse("dd2017-09-10");
			str = fmt.format(date);
			age = Integer.parseInt(s1);
		} catch (ParseException e) {
			System.out.print("替换为系统时间：");
			date = new Date();
			str = fmt.format(date);
		} catch (NumberFormatException e) {
			age = 20;
		}

		System.out.println(str);
		System.out.println(age);
	}

}
